import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    meta: { title: '祯好贷' },
    component: () => import('../views/zhd/Home.vue')
  },
  {
    path: '/FillIn',
    name: 'FillIn',
    meta: { title: '祯好贷' },
    component: () => import('../views/zhd/FillIn.vue')
  },
  {
    path: '/Result',
    name: 'Result',
    meta: { title: '祯好贷' },
    component: () => import('../views/zhd/Result.vue')
  },
  {
    path: '/Share',
    name: 'Share',
    meta: { title: '祯好贷' },
    component: () => import('../views/zhd/Share.vue')
  },
  {
    path: '/zry',
    name: 'ZryHome',
    meta: { title: '设备分期采购' },
    component: () => import('../views/zry/ZryHome.vue')
  },
  {
    path: '/zry/ZryFillIn',
    name: 'ZryFillIn',
    meta: { title: '设备分期采购' },
    component: () => import('../views/zry/ZryFillIn.vue')
  },
  {
    path: '/zry/ZryResult',
    name: 'ZryResult',
    meta: { title: '设备分期采购' },
    component: () => import('../views/zry/ZryResult.vue')
  },
  {
    path: '/zry/ZryShare',
    name: 'ZryShare',
    meta: { title: '设备分期采购' },
    component: () => import('../views/zry/ZryShare.vue')
  },
  {
    path: '/yzszh',
    name: 'YzszhHome',
    meta: { title: '语祯数字化' },
    component: () => import('../views/yzszh/YzszhHome.vue')
  }
]

const router = new VueRouter({
  routes
})

router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

export default router
